package com.xiaoer.river.define.entity;

import com.xiaoer.river.define.enums.NodeType;
import lombok.Data;

/**
 * 流程节点
 *
 * @author yinxiuhe
 * @date 2021/3/24 14:55
 */
@Data
public class FlowNode {

    /**
     * 节点key
     */
    private String key;
    /**
     * 名称
     */
    private String name;
    /**
     * 类型
     */
    private int type = NodeType.NORMAL.getCode();
    /**
     * 执行者
     */
    private String executor;
    /**
     * 重试次数
     */
    private int retry = 3;
    /**
     * 环绕处理方法
     */
    private String around;
    /**
     * 节点坐标
     */
    private int x;

    public FlowNode(String key) {
        this.key = key;
        this.name = key;

    }

    public FlowNode(String key, String executor) {
        this.key = key;
        this.executor = executor;
    }

    public FlowNode(String key, String executor, String around) {
        this.key = key;
        this.executor = executor;
        this.around = around;
    }

    public FlowNode(String key, int type, String executor) {
        this.key = key;
        this.type = type;
        this.executor = executor;
    }

    public FlowNode(String key, int type, String executor, String around) {
        this.key = key;
        this.type = type;
        this.executor = executor;
        this.around = around;
    }
}
